function debounce(fn, delay = 300) {
  let timer = null
  return function (...args) {
    console.log(123123123123)
    clearTimeout(timer)
    timer = setTimeout(() => {
      fn.call(this, ...args)
    }, delay)
  }
}

debounce(() => {
  console.log(123123)
}, 1000)
